{include file="public/head"}

<body>
<section class="content">
    <header>
        <span><a href="javascript:history.go(-1)"><img src="__STATIC__/User/img/Return.png" alt=""></a></span>
        <p>HGS卡申请</p>
        <span></span>
    </header>
    <div class="cunkuan">
        <div class="level">
            <p>HGS卡类型</p>
            <select id="level_id" class="dengji">
                {volist name="LevelList" id="v"}
                    <option value="{$v.id}">{$v.name}</option>
                {/volist}
            </select>
            <p>备注信息</p>
            <input id="remarks" type="text" class="dengji" placeholder="备注">
            <div class="btn login_btn" id="sub">提交申请</div>
        </div>
        <div class="level record">
            <ul class="top">
                <li><span>类型</span><span>时间</span><span>状态</span></li>
            </ul>
            <ul class="content">
                {volist name="LevelApply" id="v"}
                    <li>
                        <span>{$v.level_name}</span>
                        <span>{$v.add_time|date="m-d H:i",###}</span>
                        <span>
                            {if condition="$v.status eq 0"}待处理
                            {elseif condition="$v.status eq 1" /}已通过
                            {elseif condition="$v.status eq 2" /}已拒绝
                            {/if}
                        </span>
                    </li>
                {/volist}
            </ul>
        </div>
    </div>
</section>
<script src="__STATIC__/User/js/jquery-2.1.1.min.js"></script>
<script>
    $(function(){
        var Deposit = "{$Deposit}";

        if(Deposit < 100){
            alert("温馨提示:请充值美金，认购理财产品，再申请HGS卡，谢谢！");
        }
        if(Deposit >= 100 && Deposit< 1000 ){
            alert("温馨提示:当前理财 $"+Deposit+",可申请HGS银卡");
        }

        if(Deposit >= 1000 && Deposit< 3000 ){
            alert("温馨提示:当前理财 $"+Deposit+",可申请HGS银卡、HGS金卡");
        }

        if(Deposit >= 3000 && Deposit< 5000 ){
            alert("温馨提示:当前理财 $"+Deposit+",可申请HGS银卡、HGS金卡、HGS铂金卡");
        }

        if(Deposit >= 5000 && Deposit< 10000 ){
            alert("温馨提示:当前理财 $"+Deposit+",可申请HGS银卡、HGS金卡、HGS铂金卡、HGS钻石卡");
        }

        if(Deposit >= 10000 ){
            alert("温馨提示:当前理财 $"+Deposit+",可申请HGS银卡、HGS金卡、HGS铂金卡、HGS钻石卡、HGS黑卡");
        }
    })

    $("#sub").on('click',function(){
        var Deposit = "{$Deposit}";
        if(Deposit <= 0){
            alert("温馨提示:请先认购理财产品！");
            return false;
        }
        $.ajax({
            type:"POST",
            url:"{:url('User/UserLevel')}",
            data:{
                level_id : $("#level_id").val(),
                remarks : $("#remarks").val(),
            },
            dataType:"JSON",
            success:function(data){
                if(data.status == 1){
                    alert(data.message);
                    window.location.href = "{:url('Index/index')}";
                }else{
                    alert(data.message);
                }
            }
        })
    })
</script>
</body>
</html>